package com.begye.smartloan.apptest.tool

import android.app.Application
import android.content.Context
import android.content.SharedPreferences
import androidx.core.content.edit
import com.begye.smartloan.apptest.MyApplication

/**
 */
object SpTool {

    private lateinit var _context: Application
    private lateinit var _sp: SharedPreferences


    fun init(context: Application) {
        _context = context

        _sp = context.getSharedPreferences(MyApplication.product, Context.MODE_PRIVATE)
    }

    fun save(key: String, values: String) {
        _sp.edit {
            putString(key, values)
            commit()
        }
    }

    fun get(key: String): String {
        return _sp.getString(key, "") ?: ""
    }
}